package com.centerm.eterm.ui.tool;

import java.io.*;
import java.text.SimpleDateFormat;
import java.util.GregorianCalendar;

public class Log
{
	public static void LogtoFile(String message)
	{
		SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
		SimpleDateFormat timeFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
		GregorianCalendar cal = new GregorianCalendar();
		String ss = new String();
		String sb = new String();

		ss = "(" + timeFormat.format(cal.getTime()) + ")  " + message + "\r\n";
		sb = "d:/ccbconfig/logs/log_" + dateFormat.format(cal.getTime()) + ".txt";
		File f = new File(sb);
		try
		{
			FileWriter fw = new FileWriter(f, true);
			fw.write(ss);
			fw.flush();
			fw.close();
		}
		catch (IOException e)
		{
			e.printStackTrace();
		}
	};
}
